package com.gitee.linmt.service.impl;

import com.gitee.linmt.entity.RolePermission;
import com.gitee.linmt.repository.RolePermissionRepository;
import com.gitee.linmt.service.RolePermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * @author linmt
 */
@Service
public class RolePermissionServiceImpl implements RolePermissionService {

    private final RolePermissionRepository rolePermissionRepository;

    public RolePermissionServiceImpl(RolePermissionRepository rolePermissionRepository) {
        this.rolePermissionRepository = rolePermissionRepository;
    }

    @Override
    public List<RolePermission> listByRoleIds(Collection<Integer> roleIds) {
        return rolePermissionRepository.findByRoleIdIn(roleIds);
    }
}
